﻿<UserControl x:Class="nRouteWizard.Wizard.Views.WidgetConfigurationView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:n="http://nRoute/schemas/2010/xaml"
    xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" 
    mc:Ignorable="d"
    d:DesignWidth="780" d:DesignHeight="480">
	
	<UserControl.Resources>
		<n:NavigationNode x:Key="NewCustomerWizard">
			<n:NavigationNode Title="Step 1" Url="Content/Wizards/WidgetConfiguration/Step1/" />
			<n:NavigationNode Title="Step 2" Url="Content/Wizards/WidgetConfiguration/Step2/"/>
			<n:NavigationNode Title="Step 3" Url="Content/Wizards/WidgetConfiguration/Step3/"/>
		</n:NavigationNode>
		<n:ValueConverterRelay x:Key="IndexToNodeUrlConverter" />
	</UserControl.Resources>
	
	<i:Interaction.Triggers>
		<n:ReverseCommandTrigger ReverseCommand="{Binding OnCompletedReverseCommand}">
			<n:NavigateAction Url="Content/Pages/Home/"/>
		</n:ReverseCommandTrigger>
	</i:Interaction.Triggers>

    <i:Interaction.Behaviors>
        <n:BridgeViewModelBehavior/>
    </i:Interaction.Behaviors>

    <Grid x:Name="LayoutRoot" Background="White">
    	<Grid.RowDefinitions>
    		<RowDefinition/>
    		<RowDefinition Height="Auto"/>
    		<RowDefinition Height="47"/>
    	</Grid.RowDefinitions>

		<n:StatefulContainer x:Name="wizardContainer" Url="{Binding CurrentIndex, Converter={StaticResource IndexToNodeUrlConverter}, 
			ConverterParameter={StaticResource NewCustomerWizard}}">
			<!--
			OR YOU CAN USE SOMETHING LIKE
			<i:Interaction.Triggers>
				<n:ValueChangedTrigger Source="{Binding CurrentIndex}">
					<n:NavigateAction HandlerName="wizardContainer" Url="{Binding CurrentIndex, Converter={StaticResource IndexToNodeUrlConverter}, 
						ConverterParameter={StaticResource NewCustomerWizard}}" />
				</n:ValueChangedTrigger>									   
			</i:Interaction.Triggers>-->
		</n:StatefulContainer>
		
		<Border Background="Red" Grid.Row="1">
			<i:Interaction.Behaviors>
				<n:NullValueVisibilityBehavior Value="{Binding ErrorMessage}" />
			</i:Interaction.Behaviors>
			<TextBlock Margin="8" Text="{Binding ErrorMessage}" Foreground="White" FontSize="13.333" />
		</Border>
				
    	<StackPanel Margin="0,8,8,8" Orientation="Horizontal" Grid.Row="2" HorizontalAlignment="Right">
    		<Button Content="Cancel" Margin="4,0" FontSize="13.333" FontFamily="Trebuchet MS" MinWidth="80">
    			<i:Interaction.Triggers>
    				<i:EventTrigger EventName="Click">
    					<n:NavigateAction Url="Content/Pages/Home/"/>
    				</i:EventTrigger>
    			</i:Interaction.Triggers>
    		</Button>
    		<Button Content="Previous" Margin="4,0" FontSize="13.333" FontFamily="Trebuchet MS" MinWidth="80">
    			<i:Interaction.Triggers>
    				<i:EventTrigger EventName="Click">
    					<n:ExecuteCommandAction Command="{Binding PreviousCommand}" ManageEnableState="True"/>
    				</i:EventTrigger>
    			</i:Interaction.Triggers>
    		</Button>
    		<Button Content="Next" Margin="4,0" FontSize="13.333" FontFamily="Trebuchet MS" MinWidth="80">
    			<i:Interaction.Triggers>
    				<i:EventTrigger EventName="Click">
    					<n:ExecuteCommandAction Command="{Binding NextCommand}" ManageEnableState="True"/>
    				</i:EventTrigger>
    			</i:Interaction.Triggers>
    		</Button>
    		<Button Content="Finish" Margin="4,0" FontSize="13.333" FontFamily="Trebuchet MS" MinWidth="80">
    			<i:Interaction.Triggers>
    				<i:EventTrigger EventName="Click">
    					<n:ExecuteCommandAction Command="{Binding FinishCommand}" ManageEnableState="True"/>
    				</i:EventTrigger>
    			</i:Interaction.Triggers>
    		</Button>		
    	</StackPanel>
		
    </Grid>
    
</UserControl>
